<template>
  <span :class="obj.state && (obj.state === 1 ? 'right' : 'error')">{{text}}</span>
</template>

<script>
export default {
  props: {
    obj: {
      type: Object,
      default() {
        return {}
      }
    },
  },
  computed: {
    text() {
      if (!this.obj.state) {
        return '1: 未完成'
      } else if (this.obj.state === 1) {
        return '2: 正确'
      } else {
        return '3: 错误'
      }
    }
  }
};
</script>

<style scoped>
.right {
  color: green;
}
.error {
  color: red;
}
.undo {
  color: #ccc;
}
</style>